;
; SUP.SH Version 1.01 (C)1995,1996 HUDSON SOFT
; HuC6270(7UP)関連 アセンブラ用ヘッダーファイル(SUP.SH)
;
	ifndef	_SUP_SH_
_SUP_SH_	equ	1
;
;--- Macros
;
	include	"c62dev.sh"
;
SET_70A_AR	macro	arprm
		mov	arprm,at
		st.h	at,m_70_reg+ar70+_70a_(zero)
		out.h	at,IO_70A_AR
		endm
;
SET_70B_AR	macro	arprm
		mov	arprm,at
		st.h	at,m_70_reg+ar70+_70b_(zero)
		out.h	at,IO_70B_AR
		endm

_70aar		macro	reg
		out.h	reg,IO_70A_AR(zero)
		endm
;
_70asr		macro	reg
		in.h	IO_70A_AR(zero),reg
		endm
;
_70aari		macro	regno
		mov.h	regno,at
		out.h	at,IO_70A_AR(zero)
		endm
;
_70adr		macro	reg
		out.h	reg,IO_70A_DR(zero)
		endm
;
_70adrr		macro	reg
		in.h	IO_70A_DR(zero),reg
		endm
;
_70adri		macro	regno
		mov.h	regno,at
		out.h	at,IO_70A_DR(zero)
		endm
;
_70bar		macro	reg
		out.h	reg,IO_70B_AR(zero)
		endm
;
_70bsr		macro	reg
		in.h	IO_70B_AR(zero),reg
		endm
;
_70bari		macro	regno
		mov.h	regno,at
		out.h	at,IO_70B_AR(zero)
		endm
;
_70bdr		macro	reg
		out.h	reg,IO_70B_DR(zero)
		endm
;
_70bdrr		macro	reg
		in.h	IO_70B_DR(zero),reg
		endm
;
_70bdri		macro	regno
		mov.h	regno,at
		out.h	at,IO_70B_DR(zero)
		endm
;
_70MAWR		macro	vadr,dev
	local	_70mawr0
		mov.w	dev,at
		mov.w	#IO_70A,ut
		cmp	zero,at
		beq	_70mawr0
		mov.w	#IO_70B,ut
_70mawr0:
		mov.w	#_70_MAWR,at
		out.h	at,DEV_70_AR(ut)
		mov.w	vadr,at
		out.h	at,DEV_70_DR(ut)
		mov.w	#_70_VWR,at
		out.h	at,DEV_70_AR(ut)
		endm
;
_70MARR		macro	vadr,dev
	local	_70marr0
		mov.w	dev,at
		mov.w	#IO_70A,ut
		cmp	zero,at
		beq	_70marr0
		mov.w	#IO_70B,ut
_70marr0:
		mov.w	#_70_MARR,at
		out.h	at,DEV_70_AR(ut)
		mov.w	vadr,at
		out.h	at,DEV_70_DR(ut)
		mov.w	#_70_VRR,at
		out.h	at,DEV_70_AR(ut)
		endm
;
;device no
DEV70A		equ	0
DEV70B		equ	1
;
MREG70		struct
ar70		ds	2*2
cr70		ds	2*2
		align	4
		ends
;
_70a_		equ	0
_70b_		equ	2
;
SCRL70		struct
bxr70		ds	2
byr70		ds	2
		align	4
		ends
;
REG70		struct
regno		ds	2
regdat		ds	2
		align	4
		ends
;
INIT_70		macro
		jal	init_70
		endm
;
SET_70_AR	macro	regno,devno
		mov	regno,ra0
		mov	devno,ra1
		jal	set_70_ar
		endm
;
GET_70_SR	macro	devno
		mov	devno,ra0
		jal	get_70_sr
		endm
;
SET_70_DR	macro	data,devno
		mov	data,ra0
		mov	devno,ra1
		jal	set_70_dr
		endm
;
SET_70_CR	macro	crdat,devno
		mov	crdat,ra0
		mov	devno,ra1
		jal	set_70_cr
		endm
;
SET_70_REGS	macro	regs,devno
		mov	regs,ra0
		mov	devno,ra1
		jal	set_70_regs
		endm
REGTERM		equ	$ffff
;
SETUP_70_DIPLAY	macro	pram,devno
		mov	pram,ra0
		mov	devno,ra1
		jal	setup_70_diplay
		endm
;
DP70		struct
mwr		ds	2
hsr		ds	2
hdr		ds	2
vpr		ds	2
vdw		ds	2
vcr		ds	2
dcr		ds	2
		align	4
		ends
;
SAT_TRANS_TRG	macro	sat_adrs,devno
		mov	sat_adrs,ra0
		mov	devno,ra1
		jal	sat_trans_trg
		endm
;
SET_70_IW	macro	iw_data,devno
		mov	iw_data,ra0
		mov	devno,ra1
		jal	set_70_iw
		endm
GET_70_IW	macro	devno
		mov	devno,ra0
		jal	get_70_iw
		endm
;
IW_01		equ	0
IW_20		equ	1
IW_40		equ	2
IW_80		equ	3
;
SET_70_IRQBIT	macro	irqbit,devno
		mov	irqbit,ra0
		mov	devno,ra1
		jal	set_70_irqbit
		endm
;
RESET_70_IRQBIT	macro	irqbit,devno
		mov	irqbit,ra0
		mov	devno,ra1
		jal	reset_70_irqbit
		endm
;
IE_CC		equ	1
IE_OC		equ	2
IE_RC		equ	4
IE_VC		equ	8
;
SET_70_MODE	macro	mode,devno
		mov	mode,ra0
		mov	devno,ra1
		jal	set_70_mode
		endm
;
GET_70_MODE	macro	devno
		mov	devno,ra0
		jal	get_70_mode
		endm
;
BURST		equ	0
SPR_ON		equ	1
BG_ON		equ	2
SPR_BG_ON	equ	3
;
WRITE_VRAM	macro	vadrs,vdata,devno
		mov	vadrs,ra0
		mov	vdata,ra1
		mov	devno,ra2
		jal	write_vram
		endm
;
READ_VRAM	macro	vadrs,vdata,devno
		mov	vadrs,ra0
		mov	devno,ra1
		jal	read_vram
		endm
;
MRAM_TO_VRAM	macro	vadrs,vdata,len,devno
		mov	vadrs,ra0
		mov	vdata,ra1
		mov	len,ra2
		mov	devno,ra3
		jal	mram_to_vram
		endm
;
VRAM_TO_MRAM	macro	vadrs,buff,len,devno
		mov	vadrs,ra0
		mov	buff,ra1
		mov	len,ra2
		mov	devno,ra3
		jal	vram_to_mram
		endm
;
	globl	m_70_reg
;
	globl	init_70
	globl	set_70_ar,get_70_sr,set_70_dr,set_70_cr
	globl	set_70_regs
	globl	setup_70_display
	globl	sat_trans_trg
	globl	set_70_scrl
	globl	set_70_iw,get_70_iw
	globl	set_70_irqbit,reset_70_irqbit
	globl	set_70_mode,get_70_mode
	globl	write_vram,read_vram,mram_to_vram,vram_to_mram
	globl	fill_vram,fill_vramp
;
	endif	; !_SUP_SH_
;
